package com.xkdx.caipiao.presistence.identity;

import android.content.Context;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class IdentityModule extends AbsModule {
	public IdentityInfo info;

	private Context context;

	public IdentityModule(Context cx) {
		this.context = cx;
	}

	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("MainInfoGet")) {
					parseIdentity(jsonObj.getJSONObject("DetailInfo"));
				}

			}
		} catch (Exception e) {
			throw e;
		}

	}

	private void parseIdentity(JSONObject person) throws Exception {
		try {
			info = new IdentityInfo();
			info.setCardtype(person.getString("cardtype"));
			info.setCash(person.getString("cash"));
			info.setId(person.getString("id"));
			info.setIdcard(person.getString("idcard"));
			info.setPhone(person.getString("phone"));
			info.setRealname(person.getString("realname"));
			info.setVertify(person.getString("vertify"));

		} catch (Exception e) {

			throw e;
		}
	}
}
